import java.util.Scanner;

public class GuessNumber {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        do {
            int number = (int) (Math.random() * 100 + 1);
            System.out.println("请输入1-100之间的整数");
            for (int i = 7; i > 0; i--) {
                int guess = scanner.nextInt();
                if (guess > 100 || guess < 1) {
                    System.out.println("输入错误，请输入一个1到100之间的整数！");
                } else if (guess > number) {
                    System.out.println("猜大了，请重猜！");
                } else if (guess < number) {
                    System.out.println("猜小了，请重猜！");
                } else {
                    System.out.println("恭喜您，猜对了！");
                    break;
                }
                System.out.println("游戏结束！");
                System.out.println("是否开启新一轮游戏（Y/N）");
            }
        }while (scanner.next().equalsIgnoreCase("y"));
    }
}
